﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dbPoll_Application.ViewModels.DetailsViewModel>" %>


<table class="questions">
    <thead>
        <tr>
        <th>Device ID/Username</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Delete</th>
        </tr>
    </thead>
    <tbody>
        <%foreach (var participant in Model.participants)
          {%><tr>
          <%int i = 0;  
            foreach (var field in participant.Value)
            {
                if (field.Key!="Participant ID")
                {%><td><%=field.Value%></td><%i++;}
                if (i > 2) { break; }
            }
            using (Ajax.BeginForm("Delete", new 
            { participantID = participant.Key.participantID}, new AjaxOptions{UpdateTargetId = "message", OnSuccess="deleted"}))
           { %>
                    <% Html.ValidationSummary(true); %>
                    <td><input type="submit" value="Delete" /></td></tr>
                <%}
        }%>
    </tbody>
</table>
<% using (Html.BeginForm("EditGroup", "Participant", new {groupID = Model.group.groupID, pollID= Model.poll.pollID,pollName=Model.poll.name  }, FormMethod.Post))
       { %>
    <input type="submit" value="Add Participants" /> <%}%>